package com.longqin.wechat.entity;

import java.io.Serializable;

import com.longqin.wechat.util.MyObjectUtil;

/**模板实体类
 * @author Administrator
 *
 */
public class Template implements Serializable{


	private static final long serialVersionUID = 1L;
	private String touser;
	private String template_id;
	private String url;	//	模板跳转链接（海外帐号没有跳转能力）
	private Miniprogram miniprogram;//跳小程序所需数据，不需跳小程序可不用传该数据
	private TemplateKeyData data;	//	模板数据
	
	public Template() {
		super();
	}
	
	
	@Override
	public String toString() {
		StringBuilder sb=new StringBuilder();
		sb.append("微信openId:").append(this.touser)
		  .append(",内容:").append(this.data.toString())
		  .append(",详细链接:").append(MyObjectUtil.isNotNull(this.url)?this.url:"暂无" );
		return sb.toString();
	}
	
	public Template(Builder builder) {
		this.touser=builder.touser;
		this.template_id=builder.template_id;
		this.url=builder.url;
		this.miniprogram=builder.miniprogram;
		this.data=builder.data;
	}
	
	public static class Builder implements Serializable{
		private static final long serialVersionUID = 1L;
		private String touser;
		private String template_id;
		private String url;	//	模板跳转链接（海外帐号没有跳转能力）
		private Miniprogram miniprogram;//跳小程序所需数据，不需跳小程序可不用传该数据
		private TemplateKeyData data;	//	模板数据
		
		public  Builder touser(String touser) {
			this.touser=touser;
			return this;
		}
		public  Builder template_id(String template_id) {
			this.template_id=template_id;
			return this;
		}
		public  Builder url(String url) {
			this.url=url;
			return this;
		}
		public  Builder miniprogram(Miniprogram miniprogram) {
			this.miniprogram=miniprogram;
			return this;
		}
		
		public  Builder data(TemplateKeyData data) {
			this.data=data;
			return this;
		}

		public Template builder() {
			return new Template(this);
		}
	}
	
	public String getTouser() {
		return touser;
	}
	public void setTouser(String touser) {
		this.touser = touser;
	}
	public String getTemplate_id() {
		return template_id;
	}
	public void setTemplate_id(String template_id) {
		this.template_id = template_id;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public Miniprogram getMiniprogram() {
		return miniprogram;
	}
	public void setMiniprogram(Miniprogram miniprogram) {
		this.miniprogram = miniprogram;
	}
	public TemplateKeyData getData() {
		return data;
	}
	public void setData(TemplateKeyData data) {
		this.data = data;
	}
	
}
